package atguigu07.object.tostring.exer;

/**
 * ClassName: Circle
 * Package: atguigu07.object.tostring.exer
 * Description:
 *
 * @Author BuTang
 * @Create 2023/3/8 21:10
 * @Version 1.0
 */
public class Circle extends GenoetricObject {
    private double radius;

    public Circle() {
        setColor("white");
        setWeight(1.0);
        radius =1.0;
    }

    public Circle(double radius) {
        setColor("white");
        setWeight(1.0);
        this.radius = radius;
    }

    public Circle(String color, double weight, double radius) {
        super(color, weight);
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
    public double finArea(){
        return 3.14*radius*radius;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        Circle c = (Circle) obj;
        return this.finArea() == c.finArea();
    }

    @Override
    public String toString() {
        System.out.println( "原的半径是："+ this.finArea());
        return "原的半径是："+ this.finArea();

    }
}
